/**
 * Created with IntelliJ IDEA.
 * Description :
 * User: $ {USER}
 * Date: $ {YEAR}-$ {MONTH}一$ { DAY}
 * Time: ${ TIME}
 */
/*public class Test {
    public static void main(String[] args){
        //注意这里在实例化对象时，一定要给name和age的值，因为在实例化对象时，
        //会调用构造方法，而Dog这个构造方法是带有两个参数的。
        //Dog dog = new Dog("大白",8);
        //我们可以直接通过调用show方法来看看是否初始化成功
        //因为子类继承了父类的属性和方法，就相当于子类也有，
        //因此就可以按照之前我们学习的访问成员变量和方法来访问（通过 .）
        //方法是这样调用的，成员变量也是如此
        //dog.show();

        //Cat cat = new Cat("花花",7);
        //cat.show();
        Dog dog = new Dog();
        dog.show();
    }
}

class Animol{
    public String name = "dabai";
    public int age = 5;
    *//*public void show(){
        System.out.println("name:"+this.name+" age:"+this.age);
    }*//*
}

class Dog extends Animol{
    public String name = "huahua";
    *//*public Dog(String name, int age){
        this.name = name;
        this.age = age;
    }*//*
    public void show(){
        System.out.println("name:"+super.name+" age:"+super.age);
    }
}

class Cat extends Animol{
    public Cat(String name, int age){
        this.name = name;
        this.age = age;
    }
}*/


/*public class Test {
    public static void main(String[] args){
        Dog dog = new Dog();
        dog.show();
    }
}*/

/*
class Animol{
    public String name;
    public int age;
}

class Dog extends Animol{
    public String character;
    public void method() {
        name = "dabai"; // 访问从父类中继承下来的name
        age = 5; // 访问从父类中继承下来的age
        character = "忠诚"; // 访问子类自己的character
    }
}
*/


/*class Animol{
    public String name;
    public int age;
}

class Dog extends Animol{
    public String name;
    public void method() {
        name = "dabai"; // 访问子类自己的name
        age = 5; // 访问从父类中继承下来的age
    }
}*/

/*
class Animol{
    public String name = "dabai";
    public int age = 5;
    public Animol(String name, int age){
        this.name = name;
        this.age = age;
    }
    */
/*public void show(){
        System.out.println("name:"+this.name+" age:"+this.age);
    }*//*

}

class Dog extends Animol{
    public String name = "huahua";
    public Dog(String name, int age){
        super("zhangsan",3);
        this.name = name;
        this.age = age;
    }
    */
/*public void show(){
        System.out.println("name:"+super.name+" age:"+super.age);
    }*//*

}*/
